package com.javaee.term.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.javaee.term.Enums.ContactStatusEnum;
import com.javaee.term.Enums.FinshStatusEnum;
import com.javaee.term.utils.EnumUtil;

import java.text.DateFormat;
import java.util.Date;
import javax.persistence.*;

@Table(name = "purchase_info")
public class PurchaseInfo {
    /**
     * 进货表主键
     */
    @Id
    @Column(name = "purchase_id")
    private String purchaseId;

    /**
     * 进货来源
     */
    @Column(name = "purchase_source")
    private String purchaseSource;

    @Column(name = "product_id")
    private String productId;

    /**
     * 数量
     */
    @Column(name = "product_quantity")
    private Integer productQuantity;

    /**
     * 进货信息：没完成0 进货完成1
     */
    @Column(name = "finsh_status")
    private Integer finshStatus= FinshStatusEnum.UNFINISHED.getCode();

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 获取进货表主键
     *
     * @return purchase_id - 进货表主键
     */
    public String getPurchaseId() {
        return purchaseId;
    }

    /**
     * 设置进货表主键
     *
     * @param purchaseId 进货表主键
     */
    public void setPurchaseId(String purchaseId) {
        this.purchaseId = purchaseId == null ? null : purchaseId.trim();
    }

    /**
     * 获取进货来源
     *
     * @return purchase_source - 进货来源
     */
    public String getPurchaseSource() {
        return purchaseSource;
    }

    /**
     * 设置进货来源
     *
     * @param purchaseSource 进货来源
     */
    public void setPurchaseSource(String purchaseSource) {
        this.purchaseSource = purchaseSource == null ? null : purchaseSource.trim();
    }

    /**
     * @return product_id
     */
    public String getProductId() {
        return productId;
    }

    /**
     * @param productId
     */
    public void setProductId(String productId) {
        this.productId = productId == null ? null : productId.trim();
    }

    /**
     * 获取数量
     *
     * @return product_quantity - 数量
     */
    public Integer getProductQuantity() {
        return productQuantity;
    }

    /**
     * 设置数量
     *
     * @param productQuantity 数量
     */
    public void setProductQuantity(Integer productQuantity) {
        this.productQuantity = productQuantity;
    }

    /**
     * 获取进货信息：没完成0 进货完成1
     *
     * @return finsh_status - 进货信息：没完成0 进货完成1
     */
    public Integer getFinshStatus() {
        return finshStatus;
    }

    /**
     * 设置进货信息：没完成0 进货完成1
     *
     * @param finshStatus 进货信息：没完成0 进货完成1
     */
    public void setFinshStatus(Integer finshStatus) {
        this.finshStatus = finshStatus;
    }

    /**
     * 获取创建时间
     *
     * @return create_time - 创建时间
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 设置创建时间
     *
     * @param createTime 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonIgnore
    public  String getStringCreate(){
        DateFormat df5_1 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
        return  df5_1.format(createTime);
    }

    @JsonIgnore
    public FinshStatusEnum getFinshStatusEnum() {
        return EnumUtil.getByCode(finshStatus, FinshStatusEnum.class);
    }

}